# Contributor: Maxim Karasev <mxkrsv@disroot.org>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=oxipng
pkgver=9.1.2
pkgrel=0
pkgdesc="Multithreaded PNG optimizer written in Rust"
url="https://github.com/shssoichiro/oxipng"
# armhf: does not build here, and useless
arch="all !armhf"
license="MIT"
makedepends="cargo cargo-auditable"
source="https://github.com/shssoichiro/oxipng/archive/v$pkgver/oxipng-$pkgver.tar.gz
	cargo-update.patch"
options="net" # required for cargo fetch

prepare() {
	default_prepare

	# forces qemu-aarch64 on aarch64 (why??)
	rm .cargo/config.toml

	cargo fetch --locked
}

build() {
	cargo auditable build --release --frozen
}

check() {
	cargo test --frozen
}

package() {
	install -Dm755 target/release/oxipng -t "$pkgdir"/usr/bin/
}

sha512sums="
5e4ab6f8797bc03373c24886b105ffe79fb617342f9924f8fc416d1649bbc55cfe397889fba0a0211717f20807ef4e96c42cc3985c13009a1200ed755c5dc7eb  oxipng-9.1.2.tar.gz
fc5c5f822acdf1a559e64c330dc690dde4e307fe0abff9299952077a9ea3afaed9b78ca429625e6fed8bc628c0e4e72f89462cc115280ad9323b594a8c5c97c0  cargo-update.patch
"
